home *** CD-ROM | disk | FTP | other *** search
/ DOpus Plus / DOpus Plus.iso / SDK / docs / bufferedio.doc < prev    next >
Encoding:
Text File  |  1998-10-26  |  5.8 KB  |  238 lines

  1. dopus5.library/CloseBuf                               dopus5.library/CloseBuf
  2.  
  3.     NAME
  4.         CloseBuf - close a buffered file
  5.  
  6.     SYNOPSIS
  7.         CloseBuf(file)
  8.                   A0
  9.  
  10.         long CloseBuf(APTR);
  11.  
  12.     FUNCTION
  13.         Closes a file opened with OpenBuf().
  14.  
  15.     INPUTS
  16.         file - file to close
  17.  
  18.     RESULT
  19.         Any write data in the buffer is written to disk and the
  20.         file is closed. If the return value is less than zero, this
  21.         indicates there was an error writing the last chunk of data
  22.         to the file.
  23.  
  24.     SEE ALSO
  25.         OpenBuf()
  26. dopus5.library/ExamineBuf                           dopus5.library/ExamineBuf
  27.  
  28.     NAME
  29.         ExamineBuf - Examine an open file
  30.  
  31.     SYNOPSIS
  32.         ExamineBuf(file, fib)
  33.                     A0    A1
  34.  
  35.         long ExamineBuf(APTR, struct FileInfoBlock *);
  36.  
  37.     FUNCTION
  38.         This function calls ExamineFH() on the underlying DOS file handle.
  39.  
  40.     INPUTS
  41.         file - file to examine
  42.         fib - FileInfoBlock structure, must be longword aligned
  43.  
  44.     RESULT
  45.         Returns DOSTRUE if successful. The FileInfoBlock will contain
  46.         information about the open file.
  47.  
  48.     BUGS
  49.         If the file is open for writing, the file size reported by this
  50.         function may not be accurate.
  51.  
  52.     SEE ALSO
  53.         OpenBuf(), dos.library/ExamineFH()
  54.  
  55. dopus5.library/FHFromBuf                             dopus5.library/FHFromBuf
  56.  
  57.     NAME
  58.         FHFromBuf - get DOS file handle
  59.  
  60.     SYNOPSIS
  61.         FHFromBuf(file)
  62.                    A0
  63.  
  64.         BPTR FHFromBuf(APTR);
  65.  
  66.     FUNCTION
  67.         This function returns the underlying DOS file handle for a
  68.         buffered IO handle.
  69.  
  70.     INPUTS
  71.         file - buffered IO file handle
  72.  
  73.     RESULT
  74.         Returns the file handle.
  75.  
  76.     SEE ALSO
  77.         OpenBuf()
  78. dopus5.library/FlushBuf                               dopus5.library/FlushBuf
  79.  
  80.     NAME
  81.         FlushBuf - flush file buffer
  82.  
  83.     SYNOPSIS
  84.         FlushBuf(file)
  85.                   A0
  86.  
  87.         long FlushBuf(APTR);
  88.  
  89.     FUNCTION
  90.         This function flushes the buffer of a buffered IO file. If there
  91.         is any write data in the buffer, it is written to disk.
  92.         If the return value is less than zero, this indicates there was an
  93.     error writing the last chunk of data to the file.
  94.  
  95.     INPUTS
  96.         file - file handle to flush
  97.  
  98.     RESULT
  99.         The buffer is flushed.
  100.  
  101.     NOTES
  102.         In practice, you never need to call this function.
  103.  
  104.     SEE ALSO
  105.         OpenBuf(), WriteBuf(), ReadBuf()
  106. dopus5.library/OpenBuf                                 dopus5.library/OpenBuf
  107.  
  108.     NAME
  109.         OpenBuf - open a file for buffered I/O
  110.  
  111.     SYNOPSIS
  112.         OpenBuf(name, mode, bufsize)
  113.                  A0    D0     D1
  114.  
  115.         APTR OpenBuf(char *, long, long);
  116.  
  117.     FUNCTION
  118.         This function opens a file for use with the buffered I/O routines.
  119.  
  120.     INPUTS
  121.         name - name of the file to open
  122.         mode - mode to use
  123.         bufsize - size of the buffer to use
  124.  
  125.     RESULT
  126.         Returns a buffered file handle if successful, or NULL. This is
  127.         not a standard DOS file handle, and can only be used with the
  128.         other buffered IO functions.
  129.  
  130.     SEE ALSO
  131.         CloseBuf(), dos.library/Open()
  132. dopus5.library/ReadBuf                                 dopus5.library/ReadBuf
  133.  
  134.     NAME
  135.         ReadBuf - read data from a buffered file
  136.  
  137.     SYNOPSIS
  138.         ReadBuf(file, buffer, size)
  139.                  A0     A1     D0
  140.  
  141.         long ReadBuf(APTR, char *, long);
  142.  
  143.     FUNCTION
  144.         This function reads data from a buffered IO file.
  145.  
  146.     INPUTS
  147.         file - buffered IO file handle
  148.         buffer - buffer to place data in
  149.         size - size to read
  150.  
  151.     RESULT
  152.         This function returns the size of the data actually read,
  153.         or -1 if an error occurred.
  154.  
  155.     SEE ALSO
  156.         OpenBuf(), dos.library/Read()
  157.  
  158. dopus5.library/ReadBufLine                         dopus5.library/ReadBufLine
  159.  
  160.     NAME
  161.         ReadBufLine - read a line of input from a buffered file
  162.  
  163.     SYNOPSIS
  164.         ReadBufLine(file, buffer, size)
  165.                      A0     A1     D0
  166.  
  167.         long ReadBufLine(APTR, char *, long);
  168.  
  169.     FUNCTION
  170.         This function reads data from a buffered IO file, up until the
  171.         first newline character (or the buffer is full). It is similar to
  172.         the fgets() standard C function.
  173.  
  174.     INPUTS
  175.         file - buffered IO file handle
  176.         buffer - buffer to place data in
  177.         size - size to read
  178.  
  179.     RESULT
  180.         This function returns the size of the data actually read,
  181.         or -1 if an error occurred.
  182.  
  183.     SEE ALSO
  184.         OpenBuf(), ReadBuf()
  185.  
  186. dopus5.library/SeekBuf                                 dopus5.library/SeekBuf
  187.  
  188.     NAME
  189.         SeekBuf - seek within a buffered IO file
  190.  
  191.     SYNOPSIS
  192.         SeekBuf(file, offset, mode)
  193.                  A0     D0     D1
  194.  
  195.         long SeekBuf(APTR, long, long);
  196.  
  197.     FUNCTION
  198.         This function sets the read/write position for a buffered IO file.
  199.         If the seek takes the position outside of the current buffer, the
  200.         buffer will be flushed and re-read automatically.
  201.  
  202.     INPUTS
  203.         file - file to seek within
  204.         offset - offset to seek
  205.         mode - type of seet (OFFSET_BEGINNING, OFFSET_CURRENT, OFFSET_END)
  206.  
  207.     RESULT
  208.         Returns the previous file position.
  209.  
  210.     SEE ALSO
  211.         OpenBuf(), dos.library/Seek()
  212.  
  213. dopus5.library/WriteBuf                               dopus5.library/WriteBuf
  214.  
  215.     NAME
  216.         WriteBuf - write data to a buffered IO file
  217.  
  218.     SYNOPSIS
  219.         WriteBuf(file, data, size)
  220.                   A0    A1    D0
  221.  
  222.         long WriteBuf(APTR, char *, long);
  223.  
  224.     FUNCTION
  225.         Writes data to a file opened for buffered IO.
  226.  
  227.     INPUTS
  228.         file - file handle
  229.         data - data to write
  230.         size - size to write (-1 works for a null-terminated string)
  231.  
  232.     RESULT
  233.         Returns the number of bytes written, or -1 for an error.
  234.  
  235.     SEE ALSO
  236.         OpenBuf(), dos.library/Write()
  237.  
  238.